﻿#include "widget_flow.h"
#include "ui_widget_flow.h"

#include <QtWidgets>
#include "msg_config.h"
#include "net_mgr.h"
#include "dialog_handheld_command.h"

#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif



WidgetFlow::WidgetFlow(QWidget* parent)
	: QWidget(parent)
	, ui(new Ui::WidgetFlow)
{
	ui->setupUi(this);

	setStyleSheet("border-color: black;");;


	QPushButton* pump = new QPushButton();
	pump->setParent(ui->label_2);
    QRect rect(560 - 76, 354 - 162, 75, 75);
	//QPoint pt = pump->mapFromGlobal(rect.topLeft());
	//pump->setGeometry(QRect(pt.x(), pt.y(), 60, 60));
	pump->setGeometry(rect);
    pump->lower();
    //pump->show();
	//透明
     pump->setStyleSheet("background-color:rgba(255,0,0,128);");

	connect(pump, &QPushButton::clicked, [this]
		{
			//	QMessageBox::information(this, "", "工况  ");
			DialogCommand dlg;
			if (QDialog::Accepted == dlg.exec())
			{
				Msg_Config msg;
				QByteArray data = msg.ToByte();

				NetMgr::send_tcp_data(data);
			}
		});


	//QPixmap pixmap(":/UI/flow.png");

	//QImage* img = new QImage;
	//img->load("F:\\tupian\\image.jpg");

	//QSize sz = ui->label_2->sizeHint();
	//ui->label_2->setPixmap(pixmap.scaled(sz));

	//创建显示容器
	//QGraphicsScene* scene = new QGraphicsScene;
	////向容器中添加文件路径为fileName（QString类型）的文件
	//scene->addPixmap(QPixmap(":/UI/flow.png"));
	////借助graphicsView（QGraphicsView类）控件显示容器的内容
	//ui->graphicsView->setScene(scene);
	//
	//
	//
	////开始显示
	//ui->graphicsView->show();

	/*-----------------------------以下为注释-------------------------------*/
	/*
ui->graphicsView这个是显示图片的控件，可以手动创建，也可以在ui界面创建，手动创建如下
QGraphicsView *控件名 = new QGraphicsView( 需要显示的容器名,this );
QGraphicsScene *scene;
QGraphicsView *view = new QGraphicsView( scene,this );
scene->addPixmap(QPixmap(文件路径) );
view->show();
原文地址：https://zhidao.baidu.com/question/105949720.html
*/

}

WidgetFlow::~WidgetFlow()
{
	delete ui;
}
